<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		#div1{width:200px; height: 300px; border:1px solid #000; position: absolute; display: none;}
	</style>
	<script type="text/javascript">
	window.onload = function (){
		var oDiv = document.getElementById('div1');

		document.oncontextmenu = function (ev){
			var ev = ev || event;

			oDiv.style.display = 'block';
			oDiv.style.left = ev.clientX + 'px';
			oDiv.style.top = ev.clientY + 'px';

			return false;
		}

		document.onclick = function (){
			oDiv.style.display = 'none';
		}

		//阻止oDiv的冒泡行为
		oDiv.onclick = function () {
			event.cancelBubble = true;
		}
	}
	</script>
</head>
<body>
	<div id="div1"></div>
</body>
</html>